/*
 * FileName: MySelfDatasController.java
 *
 *  
 */
package com.mrc.core.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrc.core.base.CommonController;
import com.mrc.core.base.Constant;
import com.mrc.core.model.SysUser;
import com.mrc.core.service.SysUserService;

/**
 * <p>
 * Description:  处理用户自己数据相关接口
 * </p>
 *
 * @author Mrc
 * @version 4.1

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2016-12-21 下午5:34:22          Mrc        4.1         To create
 * </p>
 *
 * @since 
 * @see     
 */
@Controller
@RequestMapping(value = "/common/MySelfDatasController.do")
public class MySelfDatasController extends CommonController {
    @Autowired
    private SysUserService sysUserService;

    /**
     * 获得当前登录用户的详细信息
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping(params = "method=getInformation")
    public Map<String, Object> getInformation(HttpServletRequest request) {
        Map<String, Object> result = super.getReturnResult();
        String userMobile = (String) request.getSession().getAttribute(Constant.USER_SESSION_NAME);
        SysUser user = sysUserService.findByMobile(userMobile);
        if (user == null) {
            result.put("code", CommonController.STATUS_FAILED);
            result.put("message", "找不到登录用户");
        }
        result.put("result", user);
        return result;
    }

}
